
package types;

public class Edge {
	public short destination;		// destination of the edge
	public short source;			// source of the edge
	public int weight;			    // weight of an edge (distance)
	public boolean valid;			// if destination has been visited yet

	// constructor
	public Edge (short source, short destination, int weight) 
	{
		this.source	= source;
		this.destination = destination;
		this.weight = weight;
		this.valid = true;
	}

	// returns the source vertex
	public short getSource()
	{
		return (this.source);
	} 
	
	// returns the connecting vertex
	public short getDestination()
	{
		return (this.destination);
	} 

	// returns the weight of the edge
	public int getWeight()
	{
		return (this.weight);
	} 
	
	public void setValid(boolean bool)
	{
		this.valid = bool;
	}
	
	public boolean isValid()
	{
		return this.valid;
	}
	
	// overrides the toString()
	public String toString()
	{
		return ("{ (" + this.source + "," + this.destination + ")" +  ", " + this.isValid() + ", size " + this.weight + "} ");
	}
}
